<template>
  <div class="home" style="height:100%">
    <iframe :src="src" frameborder="0" width="100%" height="100%"></iframe>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: "home",
  data: function() {
    return {
      src: "",
      name: ""
    };
  },
  components: {},
  mounted() {
    var self = this
    this.src = this.$router.history.current.query.url;
    this.name = this.$router.history.current.query.name;
    console.log(this.src, this.name);
    $(document).ready(function() {
      if (window.history && window.history.pushState) {
        $(window).on("popstate", function() {
          window.history.pushState("forward", null, "#");
          window.history.forward(1);
          self.$router.push(`/detail?name=${self.name}`)
        });
      }
      window.history.pushState("forward", null, "#"); //在IE中必须得有这两行
      window.history.forward(1);
    });
  }
};
</script>
